<cfcomponent>
	<cffunction name="logmein" access="public" returntype="string">
		<cfargument name="username" type="string" required="yes">
		<cfargument name="password" type="string" required="yes">
		
		<cftry>
      <cfquery datasource="#application.dsn#" name="checkUser">
        SELECT *
        FROM myusers
        WHERE username = '#username#' and password = '#password#'
      </cfquery>
			<cfcatch type="any"></cfcatch>
    </cftry>
    
    <cfif checkUser.recordcount gt 0>
    	<cfset session.firstname = "#checkUser.firstname#">
      <cfset session.lastname = "#checkUser.lastname#">
      <cfset session.username = "#checkUser.username#">
      <cfset session.userID = "#checkUser.id#">
      <cfset session.email = "#checkUser.email#">
      <cfif isDefined('checkUser.desktop') and isXml(checkUser.desktop)>
				<cfset session.desktop = checkUser.desktop>
			<cfelse>
        <cfxml variable="session.desktop" casesensitive="no">
          <desktop>
            <ul>
              <name>ul1</name>
              <icon>li1_1</icon>
            </ul>
            <ul>
              <name>ul2</name>
              <icon>li2_1</icon>
            </ul>
            <ul>
              <name>ul13</name>
              <icon>li3_1</icon>
            </ul>
          </desktop>
        </cfxml>
      </cfif>
      <cfset myResult = "true">
    <cfelse>
    	<cfset myResult = "false">
    </cfif>
		
		<cfreturn myResult>
	</cffunction>
</cfcomponent>